home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
rexmooslib.lha
/
MOOS
/
Tests
/
rexx_stem.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-02-03
|
5KB
|
188 lines
/*
* rexx_dos.library
*
* Test file...
*/
OPTIONS RESULTS
lib = 'rexxMOOS.library'; IF ~SHOW('L',lib) THEN CALL ADDLIB(lib,100,-30)
/*
* StemSearch()
*/
CALL print(4,'#',"StemSearch(pattern,options)")
CALL print(20,'-',"Input stem")
in. = "Example entry..."
in.count = 20
DO n = 0 TO in.count - 1 BY 2
in.n = "random" RANDU()
END
DO n = 0 FOR in.count; SAY in.n; END
CALL print(20,'-',"StemSearch('Ex#?','in. out. Case')")
IF StemSearch('Ex#?','in. out. Case') THEN
DO n = 0 FOR out.count; SAY out.n; END
CALL print(20,'-',"StemSearch('#?dom#?','in. out. Pos 12')")
IF StemSearch('#?dom#?','in. out. Pos 12') THEN
DO n = 0 FOR out.count; SAY out.n; END
DROP in. out.
/*
* StemCopy()
*/
CALL print(4,'#',"StemCopy(options)")
CALL print(20,'-',"Destination stem")
to.count = 12
DO i = 0 FOR to.count
to.i.post = "to stem" i
END
DO i = 0 FOR to.count; SAY "TO."i".POST ==" to.i.post; END
CALL print(20,'-',"Source stem")
from. = "From stem...."
from.count = 5
DO i = 0 FOR from.count; SAY "FROM."i "==" from.i; END
CALL print(20,'-',"StemCopy('from. to.#.post ToPos 2')")
IF StemCopy('from. to.#.post ToPos 2') THEN
DO i = 0 FOR to.count; SAY "TO."i".POST ==" to.i.post; END
CALL print(20,'-',"StemCopy('to.#.post out.foo.bar. Tot 5')")
IF StemCopy('to.#.post out.foo.bar. Tot 5') THEN
DO i = 0 FOR out.foo.bar.count
SAY "OUT.FOO.BAR."i "==" out.foo.bar.i
END
DROP to. from. out.
/*
* StemInsert()
*/
CALL print(4,'#',"StemInsert(from,options)")
CALL print(20,'-',"Destination stem")
to.count = 20
DO i = 0 FOR to.count
to.i.post = "To stem" i; SAY to.i.post
END
CALL print(20,'-',"Source stem")
from. = "From stem...."
from.count = 5
DO i = 0 FOR from.count; SAY from.i; END
CALL print(20,'-',"StemInsert('from.','to.#.post ToPos 2')")
IF StemInsert('from.','to.#.post ToPos 2') THEN
DO i = 0 FOR to.count; SAY to.i.post; END
DROP to. from.
/*
* StemSort()
*/
CALL print(4,'#',"StemSort(pattern,options)")
CALL print(20,'-',"Input stem")
in.count = 20
DO n = 0 FOR in.count
in.n = WORD(ERRORTEXT(n+10),RANDU()*2%1+1); SAY in.n
END
CALL print(20,'-',"StemSort('in. out.')")
IF StemSort('in. out.') THEN
DO n = 0 FOR out.count; SAY out.n; END
CALL print(20,'-',"StemSort('in. out. Case')")
IF StemSort('in. out. Case') THEN
DO n = 0 FOR out.count; SAY out.n; END
CALL print(20,'-',"Input stem")
in.count = 20
DO n = 0 FOR in.count
in.n = COPIES(D2C(65+32*(RANDU()*2%1)+2*(RANDU()*10%1)),10)
END
DO n = 0 FOR in.count; SAY in.n; END
CALL print(20,'-',"StemSort('in. out. Descend NoDupes')")
IF StemSort('in. out. Descend NoDupes') THEN
DO n = 0 FOR out.count; SAY out.n; END
DROP in. out.
/*
* StemRemove()
*/
CALL print(4,'#',"StemRemove(options)")
CALL print(20,'-',"Input stem")
in.count = 20
DO i = 0 FOR in.count
in.i = "stem" i; SAY in.i
END
CALL print(20,'-',"StemRemove('in. FromPos 4 Tot 5')")
IF StemRemove('in. FromPos 4 Tot 5') THEN
DO i = 0 FOR in.count; SAY in.i; END
CALL print(20,'-',"Input stem")
in.count = 20
DO i = 0 FOR in.count; in.i = "in."i 1*1000; SAY in.i; END
CALL print(20,'-',"StemRemove('in. FromPos 4 ToPos 12')")
IF StemRemove('in. FromPos 4 ToPos 12') THEN
DO i = 0 FOR in.count; SAY in.i; END
DROP in.
/*
* StemWrite()
*/
CALL print(4,'#',"StemWrite(file,options)")
CALL print(20,'-',"StemWrite('T:prova','txt.')")
txt. = "Prova StemWrite()"; txt.count = 20
DO n = 0 FOR txt.count
SAY txt.n
END
IF StemWrite("T:prova","txt.") THEN DO
ADDRESS COMMAND 'Type "T:prova"'
ADDRESS COMMAND 'Delete "T:prova"'
END
DROP txt.
/*
* StemRead()
*/
CALL print(4,'#',"StemRead(file,options)")
CALL print(20,'-',"StemRead('S:Startup-Sequence','txt.')")
IF StemRead("S:Startup-Sequence","txt.") THEN
DO n = 0 FOR txt.count; SAY txt.n; END
DROP txt.
ADDRESS COMMAND 'Wait' 2
SAY
EXIT 0
print: PROCEDURE
PARSE ARG pos,char,str
IF char = '#' THEN SAY '0a0a'x
SAY COPIES(char,pos) || OVERLAY(" "str" ",COPIES(char,78 - pos))
RETURN